import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import DefineOptions from 'unplugin-vue-define-options/vite';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';

const path = require("path");

const pathResolve = (dir: string): string => {
  return path.resolve(__dirname, ".", dir);
};

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), DefineOptions(),
  createSvgIconsPlugin({
    // 指定需要缓存的图标文件夹
    iconDirs: [path.resolve(process.cwd(), 'src/components/DesignForm/icons/svg')],
    // 指定symbolId格式
    symbolId: 'icon-[name]',
  }),
  ],
  resolve: {
    alias: {
      "@": pathResolve("./src"),
      "@@": pathResolve("./src/components/DesignForm"),
    },
  },
  server: {
    port: 30000
  }
})
